﻿using Common;
using System;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data.SQLite;
namespace SqliteDataAccess
{
    public partial class SqliteDataManager
    {
        public partial class BukuKasUmumDataTable
        {
            public long TotalPenerimaan
            {
                get
                {
                    long total = 0;
                    foreach (BukuKasUmumRow row in this.Rows)
                    {
                        if (!row.IspenerimaanNull() && row.kode == "100")
                            total += row.penerimaan;
                    }
                    return total;
                }
            }

            public long TotalPengeluaran
            {
                get
                {
                    long total = 0;
                    foreach (BukuKasUmumRow row in this.Rows)
                    {
                        if (!row.IspengeluaranNull())
                            total += row.pengeluaran;
                    }
                    return total;
                }
            }

            public long TotalPajakDiterima
            {
                get
                {
                    long total = 0;
                    foreach (BukuKasUmumRow row in this.Rows)
                    {
                        if (!row.IspenerimaanNull() && Enum.IsDefined(typeof(JenisPajak), Enum.Parse(typeof(JenisPajak), row.kode)))
                            total += row.penerimaan;
                    }
                    return total;
                }
            }

            public long TotalPajakDisetor
            {
                get
                {
                    long total = 0;
                    foreach (BukuKasUmumRow row in this.Rows)
                    {
                        if (!row.IspengeluaranNull() && Enum.IsDefined(typeof(JenisPajak), Enum.Parse(typeof(JenisPajak), row.kode)))
                            total += row.pengeluaran;
                    }
                    return total;
                }
            }
        }
    }
}

namespace SqliteDataAccess.SqliteDataManagerTableAdapters
{
    public partial class BukuKasUmumTableAdapter
    {
        public string ConnectionString
        {
            get { return this.Connection.ConnectionString; }
        }
    }
    public partial class LaporanSemesterTableAdapter
    {
        public bool Exist(int semester, int tahun)
        {
            return (int)Exists(semester, tahun).Rows[0][0] > 0;
        }
    }
}

